//...
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <iostream>
#include <list>
#include <deque>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef set<int> si;

typedef struct ponto{
	double x;
	double y;
} pp;

pp a,b,c,d,e,f,p,q,r;
double ar, temp;
int resp;


pp inter(pp a, pp b, pp c, pp d){
	pp PON;
	double s, t, num, denom;
	denom=	a.x*(d.y-c.y)+b.x*(c.y-d.y)+
			d.x*(b.y-a.y)+c.x*(a.y-b.y);
	
	num=a.x*(d.y-c.y)+c.x*(a.y-d.y)+
		d.x*(c.y-a.y);
	
	s=num/denom;
	
	num=-(a.x*(c.y-b.y)+b.x*(a.y-c.y)+
		c.x*(b.y-a.y));
	
	t=num/denom;
	
	PON.x=a.x+s*(b.x-a.x);
	PON.y=a.y+s*(b.y-a.y);
	
	return PON;
}
double area(pp a,pp b,pp c){
	return a.x*(b.y-c.y)-a.y*(b.x-c.x)+(b.x*c.y-b.y*c.x);
}


int main (){
	//freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);
	int t;
	scanf("%d", &t);
	while(t--){
		scanf("%lf%lf%lf%lf%lf%lf", &a.x, &a.y, &b.x, &b.y, &c.x, &c.y);
		
		d.x = (b.x>c.x)?(  ((b.x-c.x)*2/3)+c.x  ):(  ((c.x-b.x)/3)+b.x  );
		d.y = (b.y>c.y)?(  ((b.y-c.y)*2/3)+c.y  ):(  ((c.y-b.y)/3)+b.y  );

		e.x = (c.x>a.x)?(  ((c.x-a.x)*2/3)+a.x  ):(  ((a.x-c.x)/3)+c.x  );
		e.y = (c.y>a.y)?(  ((c.y-a.y)*2/3)+a.y  ):(  ((a.y-c.y)/3)+c.y  );
		
		f.x = (a.x>b.x)?(  ((a.x-b.x)*2/3)+b.x  ):(  ((b.x-a.x)/3)+a.x  );
		f.y = (a.y>b.y)?(  ((a.y-b.y)*2/3)+b.y  ):(  ((b.y-a.y)/3)+a.y  );
		
		
		p=inter(a,d,b,e);
		q=inter(b,e,c,f);
		r=inter(a,d,c,f);
		
		ar = area(p,q,r);
		ar/=2;
		
		resp = (int)ar;
		
		temp= resp+0.5;
		resp+=((ar- 1e-8)>=temp);
		
		printf("%d\n", resp);
	}
	
	return 0;
}
